package object;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

//泛型
public class GenericDemo {
    public static void main(String[] args) {
        Collection<Point> p=new ArrayList<>();
        p.add(new Point(1,2));
        p.add(new Point(3,4));
        p.add(new Point(5,6));
        p.add(new Point(7,8));
        p.add(new Point(9,0));
        Iterator<Point> it=p.iterator();
        while(it.hasNext()){
            Point a=it.next();
            System.out.println(a);
        }

        for (Point w: p){
            System.out.println(w);
        }



























//        Collection<String> c=new ArrayList<>();
//        c.add("one");
//        c.add("two");c.add("three");c.add("four");
//        Iterator<String> a=c.iterator();
//        while(a.hasNext()){
//            String str=a.next();
//            System.out.println(str);
//        }
//        for (String b:c){
//            System.out.println(b);
//        }

    }
}
